const mongoose = require('mongoose');
const { Schema, model } = mongoose;

const historySchema = new Schema(
    {
        date: {
            type: Date,
            default: Date.now
        },
        code: String,
        name: String,
        sector: String,
        region: String,
        price: String,
        changePercent: String,
        threeDayChange: String,
        fiveDayChange: String,
        turnoverRate: String,
        volumeRatio: String,
        pe: String,
        pb: String,
        limitUpDays: String,
        predictionScore: String,
        predictionTime: String,
        predictedPrice: String,
        mainMoneyNet: String
    },
    {
        _id: { type: String, index: true },
    }
);

const History = model('History', historySchema, 'history');
module.exports = History;
